package com.hx.dc.controllor;

import com.hx.dc.entity.DcEmployee;
import com.hx.dc.entity.DetailedOrder;
import com.hx.dc.entity.DetailedRefunds;
import com.hx.dc.entity.Refunds;
import com.hx.dc.service.DetailOrderService;
import com.hx.dc.service.DetailedRefundsService;
import com.hx.dc.service.RefundsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Administrator on 2019/2/13 0013.
 */

@Controller
@RequestMapping("refunds")
public class RufundsAction extends BaseAction {

    @Autowired
    private RefundsService refundsService;

    @Autowired
    private DetailedRefundsService detailedRefundsService;


    @RequestMapping("creat")
    @ResponseBody//退单信息
    public Object creat(String refundsnum,Refunds refunds) {
        refunds.setRefundsNum(refundsnum);
        System.out.println(refunds.getRefundsNum());
        return refundsService.insert(refunds);
    }

    @RequestMapping("show")
    @ResponseBody//查询所有退单信息
    public Object refunds(Refunds refunds, Integer page, Integer rows) {
        //System.out.println("page:" + page + ",rows:" + rows+"退单");
        return this.getPage(refundsService.selectPage(refunds,page, rows));
    }

    @RequestMapping("bohui")
    @ResponseBody//驳回退单信息
    public Object bohui(Refunds refunds) {

        return refundsService.update(refunds);
    }

    @RequestMapping("allow")
    @ResponseBody//查询所有退单信息
    public Object allow(Refunds refunds) {
        System.out.println(refunds);
        return refundsService.update(refunds);
    }

    @RequestMapping("refundsinsert")
    @ResponseBody//订单生成
    public int refundsinsert(Refunds refunds) {

        System.out.println(refunds);
        return  refundsService.insert(refunds);
    }

    @RequestMapping("refundsMinginsert")
    @ResponseBody//订单生成
    public int refundsMinginsert(DetailedRefunds detailedRefunds) {
        return  detailedRefundsService.insert(detailedRefunds);
    }

    @RequestMapping("tuizong")
    @ResponseBody//订单生成
    public int tuizong(Refunds refunds) {
        return  refundsService.tuizong(refunds);
    }

    @RequestMapping("tuiming")
    @ResponseBody//退单明细
    public Object tuiming(DetailedRefunds detailedRefunds, Integer page, Integer rows) {
        return  this.getPage(detailedRefundsService.selectPage(detailedRefunds,page,rows));
    }
}
